package co.fitstart.entity.report;

public enum RevenueType {
    
    PURCHASE("purchase", "购买"),
    
    REFUND("refund", "退款");
    
    private String alias;
    
    private String description;
    
    RevenueType(String alias, String description) {
        this.alias = alias;
        this.description = description;
    }
    
    /**
     * 
     * @param alias
     * @return
     */
    public static RevenueType aliasOf(String alias) {
        for (RevenueType revenueType : RevenueType.values()) {
            if (revenueType.getAlias().equalsIgnoreCase(alias)) {
                return revenueType;
            }
        }
        return null;
    }
    
    /**
     * 
     * @return
     */
    public boolean isPurchase() {
        return this.equals(PURCHASE);
    }
    
    /**
     * 
     * @return
     */
    public boolean isRefund() {
        return this.equals(REFUND);
    }

    /**
     * @return the alias
     */
    public String getAlias() {
        return alias;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param alias the alias to set
     */
    public void setAlias(String alias) {
        this.alias = alias;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

}
